// 联合
import {z} from 'zod';

const unionSchema = z.union([
    z.string(),
    z.number(),
    z.boolean(),
    z.object({
        name: z.string(),
        age: z.number(),
    }),
    z.array(z.union([z.string(), z.number()])),
])
const allSchema = z.array(unionSchema)
let allData = [
    1,2,'3',true,false,
    {name:'a',age:1},
    ['1','2'],
    [1,2,'3','4']
]
try {
    const result = allSchema.parse(allData)
    console.log(result)
}catch (err){
    console.log(err)
}